<template>
  <div class="home">
    <!-- 顶部banner -->
    <div class="wrap banner">
      <img src="../assets/img/banner.f559b49d.png" alt="">
    </div>

    <!-- 列表 -->
    <div class="list">
      <!-- 精品推荐 -->
      <div class="wrap jinpin">
        <!-- 精品推荐顶部 -->
        <div class="top">
          <div>
            <img src="../assets/img/jingpin.png" alt="">
            <strong>精品推荐</strong>
          </div>
          <div @click="toDet" class="box">
            更多
            <span>&gt;</span>
          </div>
        </div>
        <!-- 精品推荐底部 -->
        <ul class="jinpin-top">
          <List v-for="item in arr" :key="item.id" :data="item"></List>
        </ul>
      </div>

      <!-- 热门兑换 -->
      <div class="wrap tuijian">
        <!-- 精品推荐顶部 -->
        <div class="top">
          <div>
            <img src="../assets/img/hot.png" width="40px
            " alt="">
            <strong>热门兑换</strong>
          </div>
          <div @click="toDet" class="box">
            更多
            <span>&gt;</span>
          </div>
        </div>
        <!-- 中部banner -->
        <div class="wrap banner">
          <img src="../assets/img/banner.4c6b6225.png" alt="">
        </div>
        <!-- 热门推荐底部 -->
        <ul class="tuijian-bon">
          <List v-for="item in arr2" :key="item.id" :data="item"></List>
        </ul>
      </div>

    </div>

    <!-- 鸡腿 -->
    <div class="Introduction wrap">
      <div class="top">
        <div>
          <img src="../assets/img/score.png" alt="">
          <strong>鸡腿攻略</strong>
        </div>
      </div>
      <ul class="right">
        <li>
          <img src="@/assets/img/integral-01.9386d4bf.png" alt="">
          <div class="qiandao">
            <h1>签到得鸡腿</h1>
            <div>
              去签到
            </div>
          </div>
        </li>
        <li>
          <img src="@/assets/img/integral-02.150d92a1.png" alt="">
          <div class="qiandao">
            <h1>购课得鸡腿</h1>
            <div>
              去购物
            </div>
          </div>
        </li>
        <li>
          <img src="@/assets/img/integral-03.9870f3f1.png" alt="">
          <div class="qiandao">
            <h1>推荐得鸡腿</h1>
            <div>
              去推荐
            </div>
          </div>
        </li>
        <li>
          <img src="@/assets/img/integral-04.afadcbdf.png" alt="">
          <div class="qiandao">
            <h1>做任务得鸡腿</h1>
            <div>
              做任务
            </div>
          </div>
        </li>
      </ul>
    </div>
  </div>
</template>

<script>

import List from '@/components/List.vue'
import { jingpinAPT, remenAPT } from "@/request/api"
export default {

  data() {
    return {
      arr: null,
      arr2: null
    }
  },
  components: {
    List
  },
  async created() {
    let jinpin = await jingpinAPT();
    // console.log(jinpin.data.data.data.records);
    this.arr = jinpin.data.data.data.records.filter((item, index) => index < 3)
    // console.log(this.arr);

    let remen = await remenAPT();
    // console.log(jinpin.data.data.data.records);
    this.arr2 = remen.data.data.data.records.filter((item, index) => index < 4)
    // console.log(this.arr);
  },
  methods: {
    toDet() {
      this.$router.push("/goods")
    }
  }

}
</script>

<style lang="less">
.list {
  margin-top: 20px;
  background: #F5F5F5;
  font-size: 16px;
  font-family: SourceHanSansSC;
  // padding: 60px;

  .jinpin {
    margin-bottom: 30px;
  }

  .top {
    display: flex;
    justify-content: space-between;
    align-items: center;

    img {
      vertical-align: middle;
    }
  }

  strong {
    font-size: 30px;
    font-family: SourceHanSansSC;
    font-weight: bold;
    color: #242B39;
    margin-left: 15px;
    vertical-align: middle;
  }

  span {
    display: inline-block;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 1px solid #000;
    text-align: center;
    line-height: 14px;
    font-family: "黑体";
  }

  ul {
    margin-top: 20px;
    display: flex;
    // justify-content: space-between;
    margin: 0 -10px;
    flex-wrap: wrap;


    .listli {
      width: 285px;
      margin-top: 30px;
      transition: 0.5s;
      margin: 0 10px;

      &:hover {
        transform: translateY(-10px);
      }

      &:hover .box1 {
        background-color: #0A328E;
        color: #fff;
      }
    }
  }
}

.listli {
  text-align: center;
  position: relative;
  font-size: 18px;
  font-family: SourceHanSansSC;
  font-weight: 300;
  color: #333333;

  .hide {
    img {
      position: absolute;
      top: 0;
      left: 0;
    }

  }

  h1 {
    margin-top: 20px;
    font-weight: 800;
    font-size: 20px;

  }

  p {
    margin: 15px;
    font-weight: bold;
    color: #FD604D;
  }

  // div {
  //   width: 100px;
  //   height: 36px;
  //   border: 1px solid #0A328E;
  //   margin: auto;
  //   line-height: 36px;
  //   color: #0A328E;
  //   font-weight: 800;
  // }
}

.Introduction {
  padding: 50px;

  strong {
    font-size: 30px;
    font-family: SourceHanSansSC;
    font-weight: bold;
    color: #242B39;
    margin-left: 15px;
    vertical-align: middle;
  }

  img {
    vertical-align: middle;
    transition: 0.3s;
  }

  .right {
    margin-top: 20px;
    display: flex;
    justify-content: space-between;

    li {
      position: relative;

      overflow: hidden;


      &:hover img {
        transform: scale(1.1);
      }
    }

    .qiandao {
      position: absolute;
      top: 20px;
      left: 15px;

      h1 {
        font-size: 25px;
        font-family: SourceHanSansSC;
        color: #FFFFFF;
        font-weight: 400;
      }

      div {
        margin-top: 15px;
        width: 96px;
        height: 27px;
        border: 1px solid #FFFFFF;
        font-size: 16px;
        color: #FFFFFF;
        line-height: 27px;
      }
    }
  }
}

.box {
  cursor: pointer;
}
</style>
